/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vn.edu.thptduongbachmai.DbUtil;

/**
 *
 * @author Son
 */
public class Projections {
    String propertyName;
    String aggregate;
    public Projections()
    {
        
    }

    @Override
    public String toString() {
        String result = aggregate+"("+propertyName+")";
        return result;
    }
    
    public Projections(String propertyName,String aggregate) {
        this.propertyName = propertyName;
        this.aggregate = aggregate;
    }

    public static Projections rowCount() {
        return  new Projections("*","count");
    }

    public static Projections count(String propertyName) {
         return  new Projections(propertyName,"count");

    }

 
    public static Projections max(String propertyName) {
             return  new Projections(propertyName,"max");
   }

    public static Projections min(String propertyName) {
             return  new Projections(propertyName,"min");

    }

    public static Projections avg(String propertyName) {
                 return  new Projections(propertyName,"avg");

    }

    public static Projections sum(String propertyName) {
                return  new Projections(propertyName,"sum");

    }

}
